<?php
/**
 * Created by : Sandi Rizky Kharisma (sandi.informatics08@gmail.com)
 * This Class Generated for CRUD purpose only
 */
class m_pengurus extends CI_Model {

    function __construct() {
        parent::__construct();
    }

	public function get($where = null, $limit = null, $offset = null)
    {
        if($where != null) $this->db->where($where);
        if($limit != null && $offset != null) $this->db->limit($limit, $offset);
        return $this->db->get("pengurus");
    }
	
    function get_all($limit, $uri) {

        $result = $this->db->get('pengurus', $limit, $uri);
        if ($result->num_rows() > 0) {
            return $result->result_array();
        } else {
            return array();
        }
    }

    function get_one($id) {
        $this->db->where('ID_PENGURUS', $id);
        $result = $this->db->get('pengurus');
        if ($result->num_rows() == 1) {
            return $result;
        } else {
            return array();
        }
    }

    function insert() {
           $data = array(
        
            'NAMA_JABATAN' => $this->input->post('NAMA_JABATAN', TRUE),
           
        );
        return $this->db->insert('pengurus', $data);
    }

    function update($id) {
        $data = array(
         
       'NAMA_JABATAN' => $this->input->post('NAMA_JABATAN', TRUE),
       
        );
        $this->db->where('ID_PENGURUS', $id);
        return $this->db->update('pengurus', $data);
    }

    function delete($id) {
		$this->db->where('ID_PENGURUS', $id);
        $this->db->delete('pengurus');
    }

}
?>
